package com.gss.armory.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.gss.common.domain.CommonDetailsDTO;

@Entity
@Table(name="DOC_MDATTR_VALUE")
public class DocumentMetadataValueDTO extends CommonDetailsDTO implements Serializable{
	
	private int dmaValueId;
	private int dmaId;
	private long docId;
	private DocumentMetaDataAttributesDTO attributesDTO=new DocumentMetaDataAttributesDTO();
	private String dmaValue;
	
	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	@Column(name="MDV_ID")
	public int getDmaValueId() {
		return dmaValueId;
	}
	@Column(name="MDV_DMA_ID",nullable=false)
	public int getDmaId() {
		return dmaId;
	}

	@Column(name="MDV_VALUE",length=2500)
	public String getDmaValue() {
		return dmaValue;
	}
	
	@ManyToOne(targetEntity=DocumentMetaDataAttributesDTO.class)
	@JoinColumn(name="MDV_DMA_ID",referencedColumnName="DMA_ID",insertable=false,updatable=false)
	public DocumentMetaDataAttributesDTO getAttributesDTO() {
		return attributesDTO;
	}
	
	public void setDmaId(int dmaId) {
		this.dmaId = dmaId;
	}
	
	public void setDmaValue(String dmaValue) {
		this.dmaValue = dmaValue;
	}


	public void setDmaValueId(int dmaValueId) {
		this.dmaValueId = dmaValueId;
	}
	
	public void setAttributesDTO(DocumentMetaDataAttributesDTO attributesDTO) {
		this.attributesDTO = attributesDTO;
	}
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("DocumentMetaDataAttrValueDTO [dmaId=");
		builder.append(dmaId);
		builder.append(", dmaValue=");
		builder.append(dmaValue);
		builder.append(", dmaValueId=");
		builder.append(dmaValueId);
		builder.append(", getCreatedDate()=");
		builder.append(getCreatedDate());
		builder.append(", getStrCreatedAuthor()=");
		builder.append(getStrCreatedAuthor());
		builder.append(", getVersion()=");
		builder.append(getVersion());
		builder.append("]");
		return builder.toString();
	}
	@Column(name="MDV_DOC_ID")
	public long getDocId() {
		return docId;
	}
	public void setDocId(long docId) {
		this.docId = docId;
	}

}
